﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using JXT.PrimaryKey.Batman.ObjectConverter;
using JXT.PrimaryKey.Batman.Domain.Quotation.Models;
using DTO=JXT.PrimaryKey.Batman.WcfService.Models.Quotation;

namespace JXT.PrimaryKey.Batman.WcfService.Services.Converters.Quotation
{
    public class StockConvert : AutoConvertableBase<Securities, DTO.Securities, StockConvert>, IConvertable<Securities, DTO.Securities>
    {
        protected override void BuildExpressionBackConverter(IObjectConverter<DTO.Securities, Securities> backConverter)
        {
            base.BuildExpressionBackConverter(backConverter);
            backConverter.Add(e => e.MarketType, e => e.MarketType, e => (MarketType)(byte)e);
            backConverter.Add(e => e.StockType, e => e.StockType, e => (StockType)(byte)e);
            backConverter.Add(e => e.SecuritiesType, e => e.SecuritiesType, e => (SecuritiesType)(byte)e);
        }
        protected override void BuildExpressionConverter(IObjectConverter<Securities, DTO.Securities> converter)
        {
            base.BuildExpressionConverter(converter);
            converter.Add(e => e.MarketType, e => e.MarketType, e => (DTO.MarketType)(byte)e);
            converter.Add(e => e.StockType, e => e.StockType, e => (DTO.StockType)(byte)e);
            converter.Add(e => e.SecuritiesType, e => e.SecuritiesType, e => (DTO.SecuritiesType)(byte)e);
        }
    }
}
